06. Case Study: Annotations

JAVA C2 L2 03 Demo Pt 2

INSTRUCTOR NOTE:

The case study is a REST API that retrieves a list of locations from a database. The code can be cloned from GitLab.

AnnotationDescription
@EntityThis marks a Java class as an entity, which means it will be persisted to the database. Typically, an entity maps to a database table and the table contains rows that represent that given entity.
@RestControllerThis marks a class as a REST API. @RestController is a convenience annotation that combines @Controller and @ResponseBody.
@GetMappingThis annotation handles HTTP GET requests and acts as a shortcut for @RequestMapping (method = RequestMethod.GET).

Which annotation simplifies creating RESTful web services?

SOLUTION: @RestController

Which is the MOST common term for an object that lives in a database that has the ability to be mapped to a database?

SOLUTION: Entity